INCLUDE(FindDoxygen)

IF(DOXYGEN_FOUND)
  # Generate Doxyfile
  CONFIGURE_FILE(
  ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
  ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  @ONLY)

  # Add doxygen target
  SET(DOCPATH ${CMAKE_INSTALL_PREFIX}/${PYLOTPATH_DOC})
  ADD_CUSTOM_TARGET(doxygen
    "echo" "generate doxygen documentation"
    COMMAND "mkdir" "-p" "${DOCPATH}/API/pyLot"
    COMMAND "cp" "-rvf" "${CMAKE_CURRENT_SOURCE_DIR}/*.css" "${DOCPATH}/API/pyLot"
    COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile"
    COMMAND "echo" "Doxygen documentation generated : ${DOCPATH}/API/pyLot"
    )

ELSE(DOXYGEN_FOUND)
  MESSAGE(STATUS "no doxygen documentation since \"doxygen\" not found !")
ENDIF(DOXYGEN_FOUND)
